package com.his.struts.form;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

/**
 * 医生form
 * @author liuyan
 *
 */
public class DoctorForm extends ActionForm {

	private int docid;
	private String docattend;

	private String docphone;

	private String docsex;

	private String docemail;

	private String docpass;

	private String docname;

	private String docposname;
	private String docinfo;
	
	
	private String docpicture;
	
	private FormFile pic;

	/** 
	 * Method validate 表单验证
	 * @param mapping
	 * @param request
	 * @return ActionErrors
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		
		if(pic != null){
			// 取出头像名称
			String fileName =pic.getFileName();
			// 图片类型
			if(fileName.endsWith(".jpg") || fileName.endsWith(".bmp") || fileName.endsWith(".gif") || fileName.endsWith(".jpeg")){
			int n = fileName.lastIndexOf(".");
			// 得到文件后缀名
			String houzhui = fileName.substring(n);
			// 设置头像名
			docpicture = docid+houzhui;
			} else {
				pic = null;
			}
		} else {
			pic = null;
		}
		
		return null;
	}

	/** 
	 * Method reset 表单重置
	 * @param mapping
	 * @param request
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {
	}

	public int getDocid() {
		return docid;
	}

	public void setDocid(int docid) {
		this.docid = docid;
	}



	public String getDocphone() {
		return docphone;
	}

	public void setDocphone(String docphone) {
		this.docphone = docphone;
	}

	public String getDocsex() {
		return docsex;
	}

	public void setDocsex(String docsex) {
		this.docsex = docsex;
	}

	public String getDocemail() {
		return docemail;
	}

	public void setDocemail(String docemail) {
		this.docemail = docemail;
	}

	public String getDocpass() {
		return docpass;
	}

	public void setDocpass(String docpass) {
		this.docpass = docpass;
	}

	public String getDocname() {
		return docname;
	}

	public void setDocname(String docname) {
		this.docname = docname;
	}

	public String getDocposname() {
		return docposname;
	}

	public void setDocposname(String docposname) {
		this.docposname = docposname;
	}

	public String getDocinfo() {
		return docinfo;
	}

	public void setDocinfo(String docinfo) {
		this.docinfo = docinfo;
	}


	public String getDocattend() {
		return docattend;
	}

	public void setDocattend(String docattend) {
		this.docattend = docattend;
	}

	public String getDocpicture() {
		return docpicture;
	}

	public void setDocpicture(String docpicture) {
		this.docpicture = docpicture;
	}

	public FormFile getPic() {
		return pic;
	}

	public void setPic(FormFile pic) {
		this.pic = pic;
	}

	 
}